package org.jiangy.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiangy
 */
@RequestMapping(value = "/hello")
@RestController
public class HelloController {

    @PreAuthorize("hasRole('USER')")
    @GetMapping
    public String helloUser() {
        return "hello user";
    }

    @PreAuthorize("hasRole('ADMIN')")
    @GetMapping("/admin")
    public String helloAdmin() {
        return "hello admin";
    }
}
